package demo3;
class Outer {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    static class InnerClass {
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public void test() {
            Outer outer = new Outer();
            System.out.println("InnerClass::test");
            System.out.println(outer.data1);
            System.out.println(outer.data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            //静态内部类不能直接访问外部类属性，方法，
            //因为两者依赖外部类对象，所以需要使用外部类对象进行访问
            //内部类字节码文件 外部类名称$内部类名称
        }
    }
}
public class Test {
    public static void main(String[] args) {
        //实例化静态内部类需要使用类.静态内部类
        Outer.InnerClass innerClass = new Outer.InnerClass();
        innerClass.test();
    }
}
